document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector(".btn-forcadidate-header"),t=document.querySelector(".menu-dropdown-forcandidate");let n=!1;e.addEventListener("click",(function(e){e.preventDefault(),n?(t.classList.remove("show"),t.addEventListener("transitionend",(function e(){t.style.display="none",t.removeEventListener("transitionend",e)}))):(t.style.display="inline-flex",requestAnimationFrame((()=>{t.classList.add("show")}))),n=!n})),document.addEventListener("click",(function(s){t.contains(s.target)||e.contains(s.target)||n&&(t.classList.remove("show"),t.addEventListener("transitionend",(function e(){t.style.display="none",t.removeEventListener("transitionend",e)})),n=!1)}))})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector(".btn-forenterprise-header"),t=document.querySelector(".menu-dropdown-forenterprise");let n=!1;e.addEventListener("click",(function(e){e.preventDefault(),n?(t.classList.remove("show"),t.addEventListener("transitionend",(function e(){t.style.display="none",t.removeEventListener("transitionend",e)}))):(t.style.display="inline-flex",requestAnimationFrame((()=>{t.classList.add("show")}))),n=!n})),document.addEventListener("click",(function(s){t.contains(s.target)||e.contains(s.target)||n&&(t.classList.remove("show"),t.addEventListener("transitionend",(function e(){t.style.display="none",t.removeEventListener("transitionend",e)})),n=!1)}))})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector(".btn-login-header"),t=document.querySelector(".menu-dropdown-forlogin");let n=!1;e.addEventListener("click",(function(e){e.preventDefault(),n?(t.classList.remove("show"),t.addEventListener("transitionend",(function e(){t.style.display="none",t.removeEventListener("transitionend",e)}))):(t.style.display="inline-flex",requestAnimationFrame((()=>{t.classList.add("show")}))),n=!n})),document.addEventListener("click",(function(s){t.contains(s.target)||e.contains(s.target)||n&&(t.classList.remove("show"),t.addEventListener("transitionend",(function e(){t.style.display="none",t.removeEventListener("transitionend",e)})),n=!1)}))})),document.addEventListener("DOMContentLoaded",(()=>{const e=e=>{if(!e)return NaN;const t=e.replace(/\.(?=\d{3}(\.|$|,))/g,"").replace(",",".");return parseFloat(t)},t=e=>{if(isNaN(e))return"N/A";const t=parseFloat(e.toFixed(3)),n=Math.trunc(t);let s=n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".");t<0&&0===n&&(s="-0");if(Math.abs(t-n)>=1e-4){return`${s},${t.toFixed(3).split(".")[1]||"000"}`}return s};let n;n=window.innerWidth<540?.1:.3;const s=new IntersectionObserver((n=>{n.forEach((n=>{if(n.isIntersecting){const o=n.target;if(o.classList.contains("fade-up")&&o.classList.add("visible"),o.classList.contains("animated-counter")){const n=o.dataset.valorFinal,s=e(n);if(isNaN(s))o.textContent=n||"N/A",console.error("Valor final inválido:",n,"no elemento:",o);else{((e,n,s,o)=>{let i=null;const a=c=>{i||(i=c);const d=Math.min((c-i)/o,1);let r=n+d*(s-n);e.textContent=t(r),d<1?window.requestAnimationFrame(a):e.textContent=t(s)};window.requestAnimationFrame(a)})(o,.9*s,s,1e3)}}s.unobserve(o)}}))}),{threshold:n});document.querySelectorAll(".fade-up, .animated-counter").forEach((n=>{if(n.classList.contains("animated-counter")){const s=n.dataset.valorFinal,o=e(s);let i="N/A";isNaN(o)?s&&(i=s):i=t(.9*o),n.textContent=i}s.observe(n)}))})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector(".menu-hamburguer"),t=document.querySelector(".mobile-menu"),n=document.querySelector(".icon-fechar-menu"),s=document.querySelector(".icon-menu-hamburguer");e.addEventListener("click",(function(){t.classList.add("is-visible"),requestAnimationFrame((()=>{document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden",s.classList.add("is-hidden"),t.classList.add("is-open")}))})),n.addEventListener("click",(function(e){e.stopPropagation(),s.classList.remove("is-hidden"),t.classList.remove("is-open")})),t.addEventListener("transitionend",(()=>{t.classList.contains("is-open")||(t.classList.remove("is-visible"),document.documentElement.style.overflow="",document.body.style.overflow="")}));const o=document.querySelectorAll(".dropdown-toggle");o.forEach((e=>{e.addEventListener("click",(function(e){e.stopPropagation();const t=this,n=t.nextElementSibling,s=t.classList.contains("active");if(o.forEach((e=>{e!==t&&(e.classList.remove("active"),e.nextElementSibling.style.maxHeight=null)})),s)t.classList.remove("active"),n.style.maxHeight=null;else{t.classList.add("active");const e=Math.min(n.scrollHeight,350);n.style.maxHeight=e+"px"}}))}))})),document.addEventListener("DOMContentLoaded",(function(){var e=document.querySelector(".scroll-top");window.addEventListener("scroll",(function(){window.pageYOffset>300?(e.classList.add("show"),e.classList.remove("hide")):(e.classList.add("hide"),e.classList.remove("show"))})),e.addEventListener("click",(function(e){e.preventDefault(),window.scrollTo({top:0,behavior:"smooth"})}))})),document.querySelector("#funcaoBuscaVagas").addEventListener("input",(function(e){obterSuggest("funcao","#funcaoBuscaVagas","#funcaoBuscaVagasId")})),document.querySelector("#cidadeBuscaVagas").addEventListener("input",(function(e){obterSuggest("cidade","#cidadeBuscaVagas","#cidadeBuscaVagasId")}));var validateSearchJobs=$(".search-inputs-block form").validate({onkeyup:!1,rules:{cidadeBuscaVagas:{suggest:{idHidden:"#cidadeBuscaVagasId"}},funcaoBuscaVagas:{suggest:{idHidden:"#funcaoBuscaVagasId"}}},messages:{funcaoBuscaVagas:{suggest:"Função não encontrada. Escolha uma opção da lista"},cidadeBuscaVagas:{suggest:"Cidade não encontrada. Escolha uma opção da lista"},ignore:":hidden",errorPlacement:function(e,t){e.insertAfter(t)}}});$("#cidadeBuscaVagas, #funcaoBuscaVagas").on("input",(function(){this.value||("cidadeBuscaVagas"===this.id&&$("#cidadeBuscaVagasId").val(""),"funcaoBuscaVagas"===this.id&&$("#funcaoBuscaVagasId").val(""),validateSearchJobs.element(this))})),document.querySelector(".search-inputs-block form").addEventListener("submit",(function(e){e.preventDefault(),validateSearchJobs.valid()&&this.submit()})),document.addEventListener("DOMContentLoaded",(function(){let e=null;const t=e=>{const t=e.querySelector(".more-text");t&&(t.style.height=t.scrollHeight+"px",setTimeout((()=>{t.style.height="0px",t.style.opacity="0"}),10),e.classList.remove("expanded"))};document.querySelectorAll(".read-more-link").forEach((n=>{n.addEventListener("click",(function(n){n.preventDefault();const s=this.closest(".resource-content");s&&(s.classList.contains("expanded")?(t(s),e=null):(e&&t(e),(e=>{const t=e.querySelector(".more-text");t&&(t.style.height=t.scrollHeight+"px",t.style.opacity="1",e.classList.add("expanded"),t.addEventListener("transitionend",(function e(n){"height"===n.propertyName&&(t.style.height="auto",t.removeEventListener("transitionend",e))})))})(s),e=s),n.stopPropagation())}))})),document.addEventListener("click",(function(n){if(n.target.closest(".fechar-conteudo")&&e)return t(e),e=null,void n.stopPropagation();e&&!n.target.closest(".resource-content.expanded")&&(t(e),e=null)}))})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelectorAll(".filters .filter-btn"),t=document.querySelectorAll(".states-grid");e.forEach((e=>{e.addEventListener("click",(function(){const e=document.querySelector(".filters .filter-btn.active"),n=document.querySelector(".states-grid.active"),s=this.getAttribute("data-target"),o=document.querySelector(".states-grid."+s);if(e!==this){if(n){n.querySelectorAll("a").forEach((e=>{e.style.opacity="0"}))}setTimeout((()=>{e&&e.classList.remove("active"),n&&(n.classList.remove("active"),n.querySelectorAll("a").forEach((e=>{e.style.opacity="1"}))),t.forEach((e=>{e.classList.remove("show-all");const t=e.querySelector(".show-all-cities");t&&(t.style.display="flex")})),this.classList.add("active"),o&&(o.querySelectorAll("a").forEach((e=>{e.style.opacity="0"})),o.classList.add("active"),setTimeout((()=>{o.querySelectorAll("a").forEach((e=>{e.style.opacity="1"}))}),20))}),250)}}))})),document.querySelectorAll(".states-grid").forEach((function(e){const t=e.querySelector(".show-all-cities");t&&t.addEventListener("click",(function(n){n.preventDefault(),e.classList.add("show-all"),t.style.display="none"}))}))}));const track=document.querySelector(".blog-posts-track"),posts=document.querySelectorAll(".blog-post"),nextBtn=document.getElementById("nextSlide"),prevBtn=document.getElementById("prevSlide"),gap=40;let currentSlide=0,maxClicks=8;function getCardWidth(){const e=document.querySelector(".blog-post");return e?e.offsetWidth:0}function updateMaxClicks(){const e=window.innerWidth;maxClicks=e>560?6:8}function updateSlide(){const e=getCardWidth(),t=currentSlide*(e+40);track.style.transform=`translateX(-${t}px)`}nextBtn.addEventListener("click",(()=>{updateMaxClicks(),currentSlide{currentSlide>0&&(currentSlide--,updateSlide())})),window.addEventListener("resize",(()=>{updateMaxClicks(),updateSlide()})),updateMaxClicks(),updateSlide(),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelectorAll(".slide-content"),t=document.getElementById("nextBtn"),n=document.getElementById("prevBtn");let s=0;function o(t){e.forEach(((e,n)=>{e.classList.remove("active"),n===t&&e.classList.add("active")}))}t.addEventListener("click",(function(){s=(s+1)%e.length,o(s)})),n.addEventListener("click",(function(){s=(s-1+e.length)%e.length,o(s)})),o(s)})),document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".states-grid a").forEach((function(e){e.addEventListener("click",(function(t){const n=document.querySelector(".filters .filter-btn.active"),s=n?n.textContent.trim():"Desconhecido",o=e.textContent.trim();window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"statesGridClick",filtro:s,link_texto:o})}))}))}));